﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FrmMain;

namespace MyKTV
{
    public partial class FrmAddSinger : Form
    {
        public FrmAddSinger()
        {
            InitializeComponent();
        }
        Dao dao = new Dao();
        private void FrmAddSinger_Load(object sender, EventArgs e)
        {
            string sql = "select * from singer_type";
            this.comboBox1.DataSource = dao.GetTable(sql);
            comboBox1.DisplayMember = "singertype_name";
            comboBox1.ValueMember = "singertype_id";
        }
  
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = string.Format(@"insert into singer values ('{0}',{1},'{2}','')",textBox1.Text,comboBox1.SelectedValue,radioButton1.Checked?"男":"女");
            if (dao.DoNonquery(sql) > 0)
            {
                MessageBox.Show("添加成功");
                this.Close();
            }
            else {
                MessageBox.Show("添加失败");
            }
        }
    }
}
